package cn.snowheart.strategy.spring.service.impl;

import cn.snowheart.strategy.spring.context.HandlerContext;
import cn.snowheart.strategy.spring.entity.OrderDTO;
import cn.snowheart.strategy.spring.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * @author liuwanxiang
 * @version 2019/06/24
 */
@Service
@Qualifier("OrderServiceV2Impl")
public class OrderServiceV2Impl implements IOrderService {

    @Autowired
    private HandlerContext context;

    @Override
    public String handle(OrderDTO order) {
        return context.getOrderHandler(order.getType()).handle(order);
    }
}
